package com.ssm.juc.sync;

import org.openjdk.jol.info.ClassLayout;

public class ClassLayoutTest {

    public static void main(String[] args) throws InterruptedException {
        //jvm 延迟偏向

        Thread.sleep(4000);
        Object obj = new Object();
        //查看对象内部信息
        System.out.println(ClassLayout.parseInstance(obj).toPrintable());

        new Thread(() -> {
            synchronized (obj) {
                try {
                    //obj.hashCode();
                    //obj.wait(100); 变成重量级锁
                    obj.notify();
                    System.out.println(ClassLayout.parseInstance(obj).toPrintable());
                }catch (Throwable t) {}
            }
        }).start();

    }
}
